home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SCREEN / CURSES01 / minix / c / unctrl < prev    next >
Text File  |  1991-05-05  |  2KB  |  47 lines

  1. /****************************************************************/
  2. /* Unctrl() routines of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /****************************************************************/
  13. /* Modified to run under the MINIX operating system by Don Cope */
  14. /* These changes are also released into the public domain.      */
  15. /*                             900906  */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include "curspriv.h"
  20.  
  21. static char    strbuf[3] = {0,0,0};
  22.  
  23. /****************************************************************/
  24. /* Unctrl() returns a char pointer to a string corresponding to    */
  25. /* argument character 'c'.                    */
  26. /****************************************************************/
  27.  
  28. char *unctrl(c)
  29.   char c;
  30.   {
  31.   int ic = c;
  32.   ic &= 0xff;
  33.   
  34.   if ((ic >= ' ') && (ic != 0x7f))        /* normal characters */
  35.     {
  36.     strbuf[0] = ic;
  37.     strbuf[1] = '\0';
  38.     return(strbuf);
  39.     } /* if */
  40.   strbuf[0] = '^';                /* '^' prefix */
  41.   if (c == 0x7f)                /* DEL */
  42.     strbuf[1] = '?';
  43.   else                        /* other control */
  44.     strbuf[1] = ic + '@';
  45.   return(strbuf);
  46.   } /* unctrl */
  47.